package user;
import java.util.*;

import edu.cmu.javadb.*;
import edu.cmu.javadb.plan.condition.In;
import static edu.cmu.javadb.plan.condition.Condition.*;

public class LinkTest {
	public static <T>void showAll(Iterable<T> c) {
		for (T rec : c) {
			System.out.print(rec + " ");
			System.out.println();
		}
	}
	
	public static void main(String[] args) {		
		VCollection<Person> c1 = VCollection.getInstance(Person.class);
		
		Dept d1 = new Dept("d1");
		Dept d2 = new Dept("d2");
		Dept d3 = new Dept("d3");
		Dept d4 = new Dept("d4");
		
		Person p1 =  new Person("A", d1);
		c1.add(p1);
		c1.add( new Person("B", d2));
		c1.add( new Person("C", d3));
		c1.add( new Person("D", d1));
		c1.add( new Person("E", d2));
		c1.add( new Person("F", d2));
		System.out.println("\ncollection 1");
		showAll(c1);
		
		VCollection<Dept> c2 = VCollection.getInstance(Dept.class);
		showAll(c2);
		
		System.out.println("after change");
		p1.setDept(d4);
		showAll(c2);
	}
}
